import { Injectable } from '@angular/core';
import { ApiService } from '@core/net/api.service';
import { IHttpRes } from '@core/net/HttpResponse';
import { IDiscloseList, IDiscloseTitle, IDiscloseTreat } from '@model/disclose';

@Injectable({
	providedIn: 'root'
})
export class DiscloseService {

	constructor(
		private apiService: ApiService
	) { }
	/**
	 * 爆料主题列表
	 * @param params 
	 * @returns 
	 */
	getDiscloseTitleList(params): Promise<IHttpRes<{ list: Array<IDiscloseTitle>, totalCount: number }>> {
		return this.apiService.post('/info/tdatadisclosetitle/list', params).toPromise();
	}

	/**
	 * 删除爆料主题
	 * @param id 
	 * @returns 
	 */
	deleteDiscloseTitle(id: number): Promise<IHttpRes<any>> {
		return this.apiService.post('/info/tdatadisclosetitle/delete/' + id).toPromise();
	}

	/**
 * 新增爆料主题
 * @param body 
 * @returns 
 */
	saveDiscloseTitle(body): Promise<IHttpRes<any>> {
		return this.apiService.post('/info/tdatadisclosetitle/save', body).toPromise();
	}


	/**
	 * 获取爆料列表
	 * @param body 
	 * @returns 
	 */
	getDiscloseList(body): Promise<IHttpRes<{ list: Array<IDiscloseList>, totalCount: number }>> {
		return this.apiService.post('/info/tdatadisclose/list', body).toPromise();
	}

	/**
	 * 爆料处理
	 * @param body 
	 * @returns 
	 */
	saveDisclose(body): Promise<IHttpRes<any>> {
		return this.apiService.post('/info/tdatadisclose/save', body).toPromise();
	}
	/**
	 * 爆料审核记录列表
	 * @param body 
	 * @returns 
	 */
	getDiscloseTreatList(id): Promise<IHttpRes<Array<IDiscloseTreat>>> {
		return this.apiService.post(`/info/tdatadisclose/treatList/${id}`).toPromise();
	}
	/**
	 * 爆料审核记录列表
	 * @param body 
	 * @returns 
	 */
	updateDisclose(body): Promise<IHttpRes<any>> {
		return this.apiService.post(`/info/tdatadisclose/update`, body).toPromise();
	}

}
